package co.edu.unal.geditor.model;

import java.awt.Color;
import java.awt.Font;
import java.awt.Point;

import co.edu.unal.geditor.view.ElementView;
import co.edu.unal.geditor.view.TextGraphView;

public class TextElement extends ClosedGraphElement
{
	private static final long serialVersionUID = 1L;
	
	protected TextElement( Point pUL, Point pBD )
	{
		super( pUL, pBD );
		
		setText( "" );
	}
	
	public TextElement( Point pUL, Point pBD, String text )
	{
		super( pUL, pBD);
		int m_size;
		m_size=getBoundBox().getHeight();
		
		setText( text );
		setFont(null,m_size);
	}
	
	protected TextElement( Point pUL, Point pBD, Color color, String text )
	{
		super( pUL, pBD, color );
		int m_size;
		m_size=getBoundBox().getHeight();
		
		
		setText( text );
		setFont(null,m_size);
	}
	public Font getFont() {
		return m_font;
	}

	public void setFont(Font font, int size) {
		
		this.m_font=new Font(null, 0, size);

	}
	
	public String getText()
	{
		return m_text;
	}
	
	public void setText( String text )
	{
		assert text != null;
		
		m_text = text;
	}

	@Override
	protected ElementView createView()
	{
		// start with graphics view by default
		
		return new TextGraphView( this );
	}
	
	// the text this element renders
	private String m_text;
	private Font m_font;


}
